package com.jsf.controller;


import com.baomidou.mybatisplus.extension.service.IService;
import com.jsf.entity.Emp;
import com.jsf.entity.Equipment;
import com.jsf.service.IEmpService;
import com.jsf.service.IEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jsf
 * @since 2022-02-21
 */
@RestController
@RequestMapping("/equipment")
public class EquipmentController {
    @Autowired
    private IEquipmentService es;
    @GetMapping("/selectAll")
    public List<Equipment> selectAll(){
        return es.list();
    }

    @PostMapping("/add")
    public void add(@RequestBody Equipment eqpm){
        eqpm.setCreateDate(LocalDate.now());
        es.save(eqpm);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        es.removeById(id);
    }
}

